import { Profile, User } from '@/types/data'
import { ProfileAction } from '@/types/store'
type ProfileState = {
  user: User
  profile: Profile
}
const init: ProfileState = {
  user: {} as User,
  profile: {} as Profile,
}
export default function proflie(state = init, action: ProfileAction): ProfileState {
  if (action.type === 'profile/getUser') {
    return {
      ...state,
      user: action.payload,
    }
  }
  if (action.type === 'profile/getUserProfile') {
    return {
      ...state,
      profile: action.payload,
    }
  }
  return state
}
